

//Ctrl+Enter to Post
function CtrlEnter(){
    if (event.ctrlKey && window.event.keyCode == 13) 
        document.form1.btnSubmit.click();
}

//Check Form
function Checkform1(){
    var errMessage, bError, theForm;
    theForm = document.form1;
    theForm.btnSubmit.disabled = true;
    errMessage = "Some Required Field has not filled.";
    bError = false;
    if (theForm.log_catid.value == "0") {
        errMessage += "\n - Please Select a Category";
        bError = true;
    }
    if (theForm.log_title.value == "") {
        errMessage += "\n - Please Input the Title";
        bError = true;
    }
    if (theForm.message.value == "") {
        errMessage += "\n - Please Input the Content";
        bError = true;
    }
    if (bError) {
        alert(errMessage);
        theForm.btnSubmit.disabled = false;
        return false;
    }
    else {
        theForm.submit();
        return true;
    }
}

// Set article post time in edit form
function setToCurrentTime(){
    var theDate = new Date();
    var str = theDate.getFullYear() + "-" + (theDate.getMonth() + 1) + "-" + theDate.getDate() + " " + theDate.getHours() + ":" + theDate.getMinutes() + ":" + theDate.getSeconds();
    var obj = document.getElementById("log_postTime");
    obj.value = str;
}
